/*
 * @Author: YuWuChen82 1813109877@qq.com
 * @Date: 2025-07-21
 * @LastEditors: YuWuChen82 1813109877@qq.com
 * @LastEditTime: 2025-07-21
 * @FilePath: \antd-demo\src\pages\Home\components\BarChart.jsx
 * @Description: 
 */
import React, { useEffect, useRef } from 'react'
import * as echarts from 'echarts';

function BarChart({title,data}) {
    const chartRef = useRef(null)
    useEffect(() => {
      var chartDom = chartRef.current;
      var myChart = echarts.init(chartDom);
      var option;
  
      option = {
        title: {
          text: title
        },
        xAxis: {
          type: 'category',
          data: data
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [10, 40, 70],
            type: 'bar'
          }
        ]
      }; option && myChart.setOption(option);
    }, [title,data])
    return (
      <div>
        <div ref={chartRef} style={{ width: '500px', height: '400px' }}>
  
        </div>
      </div>
    )
}

export default BarChart